BigDFT.Logfiles module

This module is useful to process a logfile of BigDFT run, in yaml format. It also provides some tools to extract typical informations about the run, like the energy, the eigenvalues and so on.

class Energies(filename, units='AU', disp=None, strict=True)[source]

Find the energy terms from a BigDFT logfile. May also accept malformed logfiles that are issued, for instance, from a badly terminated run that had I/O error.

  • filename (str) – path of the logfile

  • units (str) – may be ‘AU’ or ‘kcal/mol’

  • disp (float) – dispersion energy (will be added to the total energy)

  • strict (bool) – assume a well-behaved logfile

property to_dict
class Logfile(*args, **kwargs)[source]

Import a Logfile from a filename in yaml format, a list of filenames, an archive (compressed tar file), a dictionary or a list of dictionaries.

  • *args – sequence of logfiles to be parsed. If it is longer than one item, the logfiles are considered as belonging to the same run.

  • **kwargs

    describes how the data can be read. Keywords can be:

    • archive: name of the archive from which retrieve the logfiles.

    • member: name of the logfile within the archive. If absent, all the

      files of the archive will be considered as args.

    • label: the label of the logfile instance

    • dictionary: parsed logfile given as a dictionary,

      serialization of the yaml logfile


>>> l = Logfile('one.yaml','two.yaml')
>>> l = Logfile(archive='calc.tgz')
>>> l = Logfile(archive='calc.tgz',member='one.yaml')
>>> l = Logfile(dictionary=dict1)
>>> l = Logfile(dictionary=[dict1, dict2])


Document the automatically generated attributes, perhaps via an inner function in futile python module


For a set of logfiles construct the convergence plot if available. Plot the Maximum value of the forces against the difference between the minimum value of the energy and the energy of the iteration. Also an errorbar is given indicating the noise on the forces for a given point. Show the plot as per with matplotlib.pyplots as plt

>>> tt=Logfile('log-with-geometry-optimization.yaml')
>>> tt.geopt_plot()

Return an instance of the BrillouinZone class, useful for band structure. :returns: Brillouin Zone of the logfile :rtype: BigDFT.BZ.BrillouinZone


Get the density of states from the logfile.

Fill a py:class:~BigDFT.DoS.DoS class object with the information which is stored in this logfile.


**kwargs – Keyword Arguments of the py:class:~BigDFT.DoS.DoS class.


class instance. Filled with bandarrays and


Return type



Label of the Logfile instance


Absolute path of the directory of logfile


Plot the wavefunction convergence. :Example:

>>> tt=Logfile('log-with-wfn-optimization.yaml',label='a label')
>>> tt.wfn_plot()

Identify the different block of the iterations of the wavefunctions optimization.


Should be generalized and checked for mixing calculation and O(N) logfiles


log (dictionary) – logfile load


wavefunction residue per iterations, per each subspace diagonalization

Return type

numpy array of rank two


Return a list of loaded logfiles from files, which is a list of paths leading to logfiles.



files – List of filenames indicating the logfiles


List of Logfile instances associated to filename

plot_wfn_convergence(wfn_it, gnrm_cv, label=None)[source]

Plot the convergence of the wavefunction coming from the find_iterations function. Cumulates the plot in matplotlib.pyplot module

  • wfn_it – list coming from find_iterations()

  • gnrm_cv – convergence criterion for the residue of the wfn_it list

  • label – label for the given plot